package com.qf.BaseController;

import cn.dsna.util.images.ValidateCode;
import com.sun.deploy.net.HttpRequest;
import com.sun.deploy.net.HttpResponse;

import javax.jws.WebService;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Wy
 * @version V1.0
 * @Project javaWeb项目
 * @Package com.qf.BaseController
 * @Description:
 * @Date 2022/5/23 11:41
 */
@WebServlet("/code")
public class CodeController extends  BaseServlet{
      public void createCode(HttpServletRequest request, HttpServletResponse response) throws IOException {
          ValidateCode validateCode = new ValidateCode(100, 30, 4, 10);
          String code = validateCode.getCode();
          request.getSession().setAttribute("code",code);
          validateCode.write(response.getOutputStream());


      }
}
